﻿using Abp.Application.Services;
using Abp.Domain.Repositories;
using Abp.Linq.Extensions;
using AbpVueDemo.MaterialsDemo.StockManager.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AbpVueDemo.MaterialsDemo.StockManager
{
    public class StockService : AsyncCrudAppService<stockmanager,StockInputDto, int, PageStockDto, StockCreateDto, StockUpdateDto>, IStockService
    {
        public StockService(
      IRepository<stockmanager, int> repository) : base(repository)
        {

        }
        protected override IQueryable<stockmanager> CreateFilteredQuery(PageStockDto input)
        {
            return base.CreateFilteredQuery(input)
                .WhereIf(!string.IsNullOrEmpty(input.m_name), c => c.m_name.Contains(input.m_name))
                .WhereIf(!string.IsNullOrEmpty(input.m_texture), c => c.m_texture.Contains(input.m_texture))
                .WhereIf(!string.IsNullOrEmpty(input.m_proposer), c => c.m_proposer.Contains(input.m_proposer));
        }
    }
}
